﻿using System.Web.UI.WebControls;
using Medianamik.Core;
using Medianamik.Globalization;
using Medianamik.UI.Controls;

namespace Medianamik.UI.Web.Shop
{
    public partial class ShopEditInvariantCulture : BaseModuleEditionPage<NodeWrapper>
    {
        protected override void OnInit(System.EventArgs e)
        {
            PublishLinkButton.Visible = CurrentNode.NodeType.IsVersioned;

            RevertButton.Visible = CurrentNode.NodeType.IsVersioned
                                   && IsEdition
                                   && CurrentNode.IsDraft
                                   && !Revision.HasValue
                                   && CurrentNode.DefaultInstance.Revisions.Length > 0;

            RevertButton.Attributes.Add("onclick",
                "return confirm('" +
                Translator.TranslateJS("Medianamik_ContentManagement", "ConfirmRevert") + "');");

            base.OnInit(e);
        }

        public override LinkButton SaveButton
        {
            get { return SaveLinkButton; }
        }

        public override MedianamikFormTemplate MedianamikFormTemplate
        {
            get { return Fields; }
        }

        protected override string TypeIdParamName
        {
            get
            {
                return DefaultParamNames.TypeID;
            }
        }

        protected override string ParentNodeIdParamName
        {
            get
            {
                return DefaultParamNames.ParentNodeID;
            }
        }
    }
}
